package com.aaa.stream.demo05;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author C-Q
 * @version 1.1.0
 * @Description: TODO
 * @date 2022/11/5
 */
public class Test {
    public static void main(String[] args) {
        //自定义时间的日期--设计不合理
        Date date = new Date(2022, 11, 5);
        System.out.println("date = " + date);
        //时间格式化---存在线程安全问题
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
        System.out.println("formatter = " + formatter);
        for (int i = 0; i < 10; i++) {
            new Thread(new Runnable() {
                @Override
                public void run() {
                    try {
                        System.out.println(formatter.parse("2022-11-5"));
                    } catch (ParseException e) {
                        e.printStackTrace();
                    }
                }
            }).start();
        }
    }
}
